package com.bootssm.service.impl;

import com.bootssm.dao.HolidayMapper;
import com.bootssm.entity.Holiday;
import com.bootssm.entity.HolidayVO;
import com.bootssm.service.HolidayService;
import com.bootssm.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class HolidayServiceImpl implements HolidayService {

    @Autowired
    HolidayMapper holidayMapper;

    @Override
    public List<Holiday> findAll(HolidayVO holidayVO) {
        return holidayMapper.findAll(holidayVO);
    }

    @Override
    public Integer getCount(HolidayVO holidayVO) {
        return holidayMapper.getCount(holidayVO);
    }

    @Override
    public void deleteById(String id) {
        holidayMapper.deleteById(id);
    }

    @Override
    public void update(Holiday holiday) {
        holidayMapper.update(holiday);
    }

    @Autowired
    IdWorker idWorker;

    @Override
    public void save(HolidayVO holidayVO) {
       holidayVO.setHolidayid(idWorker.nextId()+"");
        holidayMapper.save(holidayVO);

    }
}
